<?php

namespace Biz\Mailers\User\Tags;

use Biz\Mailers\MailerTags;
use Biz\Dictionaries\TitleDict;
use Biz\Models\User\UserMember;
use Biz\Dictionaries\GenderDict;

/**
 * UserMemberTags.
 *
 * @license [http://www.85do.com] [杭州永奥网络科技有限公司]
 * @copyright Copyright (c) 2018-2026 Hangzhou Yongao Technology Co., Ltd. All rights reserved.
 */
class UserMemberTags extends MailerTags
{
    /**
     * @var \Biz\Models\User\UserMember
     */
    protected $member;

    /**
     * SiteTags constructor.
     *
     * @param UserMember $member
     */
    public function __construct(UserMember $member)
    {
        $this->member = $member;

        $this->supportTags();
    }

    /**
     * Support Tags.
     */
    public function supportTags(): void
    {
        $title = '';
        if ($this->member->title) {
            $title = TitleDict::get($this->member->title);
        }
        $gender = '';
        if ($this->member->gender) {
            $gender = GenderDict::get($this->member->gender);
        }

        $this->tags['UserTitle']      = $title;
        $this->tags['UserGender']     = $gender;
        $this->tags['UserFirstName']  = $this->member->first_name;
        $this->tags['UserMiddleName'] = $this->member->middle_name;
        $this->tags['UserLastName']   = $this->member->last_name;
    }
}
